<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    .box {
      width: 100px;
      height: 800px;
      border: 1px solid #ccc;
      position: relative;
    }
    .icon {
      width: 20px;
      height: 20px;
      background-color: red;
      position: absolute;
      right: 0;
      bottom: 0;
      cursor: se-resize;
    }
  </style>
  <body>
    <div>
      <div class="box" contenteditable="true"><div class="icon"></div></div>
    </div>
    <button id="btn">点击</button>
  </body>
  <script>
    document.getElementById("btn").onclick = function () {
      console.log(window.location);
      window.open("http://www.baidu.com");
    };
    let icon = document.querySelector(".icon");
    let box = document.querySelector(".box");
    let firstY = 0;
    icon.onmousedown = function (e) {
      firstY = e.pageY;
      console.log(firstY);
      document.addEventListener("mousemove", fn);
    };
    document.onmouseup = function () {
      document.removeEventListener("mousemove", fn);
    };
    function fn(e) {
      let height = box.clientHeight;
      let heightC = e.pageY - firstY;
      console.log(firstY);
      box.style.height = height + heightC + "px";
      firstY = height + heightC;
    }
  </script>
</html>
